import Vue from 'vue'
import Router from 'vue-router'
import mainContent from '@/layout'

Vue.use(Router)

export const constantRoutes = [
	{
		path: '/',
		name: '/',
		redirect: '/home',
		component: mainContent,
		children: [
			{
				path: '/home',
				name: '首页',
				component: () => import('@/views/home/home')
			}
		]
	},
	{
		path: '/login',
		name: 'login',
		component: () => import('@/views/login/login')
	}
]

export default new Router({
	mode: 'history',
	scrollBehavior (to, from, savedPosition) {
		// 始终滚动到顶部
		return { x: 0, y: 0 }
	},
	routes: constantRoutes
})
